package com.me.bbs.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.me.bbs.dto.ViewRecordDTO;
import com.me.bbs.entity.ViewRecord;
import com.me.bbs.mapper.ViewRecordMapper;
import com.me.bbs.service.IViewRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lm
 * @since 2023-01-09
 */
@Service
public class ViewRecordServiceImpl extends ServiceImpl<ViewRecordMapper, ViewRecord> implements IViewRecordService {
    @Resource
    ViewRecordMapper viewRecordMapper;
    @Override
    public Page<ViewRecordDTO> getViewRecordList(Page<ViewRecord> page, Wrapper<ViewRecord> wrapper) {
        return viewRecordMapper.selectPageByUser(page, wrapper);
    }

    @Override
    public Long getTodayViewCountByForum(Long forumId, LocalDateTime dateTime) {
        viewRecordMapper.selectTodayViewCountByForumId(forumId,dateTime);
        return null;
    }
}
